package com.example.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Auther: tong
 * @Date: 2023/01/19/16:48
 * @Description:
 */
@Component
@Aspect
@Order(1)
public class MyAspect2 {
    @Pointcut("execution(* com.example.service..*.doService(..))")
    public void doService(){}

    @Around("doService()")
    public Object doAround(ProceedingJoinPoint pjp){
        Object result = null;
        try {
            System.out.println("MyAspect2增强");
            result=pjp.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return result;
    }
}
